<?php

/*
  Treasure	$5

  1$
  While this in play, when you buy a Treasure card, gain a copy of it

 */

class Geom extends Card implements iTreasure, iKingdom, iAddiction, iReactingCard {

    public function __construct() {
        parent::__construct("Geom", 5);
        $this->undoPlay = false;
        $this->undoBuy = true;

        $this->value = new Price(1);

        $this->reactConditions = new ReactionConditions();
        $this->reactConditions->action = array(Buy);
        $this->reactConditions->actor =array(Yourself);
        $this->reactConditions->cardLocation = array(PlayArea);
        $this->reactConditions->limit = ForEachCard;
        $this->reactConditions->isMandatory = true;
    }

    public function getDescription() {
        return array(
            "Worth $1",
            "While this in play, when you buy a Treasure card, gain a copy of it");
    }
    
    public function autoPlayNum(Game $game) {
        return -1;
    }

    public function play(Game $game, $isRealCard) {
        
    }

    public function getConditions() {
        return $this->reactConditions;
    }

    public function isReactRelevant(Game $game, $card, $name) {
        if ($card instanceof iTreasure)
            return true;
        return false;
    }

    public function react(Game $game, $card, $name) {
        if ($card instanceof iTreasure) {
            ScreenDisplay::addScreenMessage($game, true, "activate ".  nicePrint($this), "activates ".  nicePrint($this), $name);
            $card = $game->moveCardFromPileToPile($card, BoardCards, DiscardPile, $name);
            ScreenDisplay::addScreenMessage($game, true, "gain " . nicePrint($card), "gains " . ScreenDisplay::$LMSG, $name);
            $game->setTempCard($card);
        }
        return true;
    }

}

?>